package com.jackchen.vo;

import java.util.List;

import com.jackchen.common.i18n.ModelString;
import com.jackchen.common.transform.BindConvert;
import com.jackchen.common.transform.FieldConvert;
import com.jackchen.po.Category;

@BindConvert(targetClass = Category.class)
public class CategoryVO {

	@FieldConvert(targetFiledName = { "id" })
	private Integer id;
	@FieldConvert(targetFiledName = { "name", "value" })
	private String name;
	@FieldConvert(targetFiledName = { "keyassit" })
	private String keyassit;
	@FieldConvert(targetFiledName = { "pagename" })
	private String pagename;
//	@FieldConvert(targetFiledName = { "iconenable" })
//	private String iconenable;
	@FieldConvert(targetFiledName = { "level" })
	private Integer level;
	@FieldConvert(targetFiledName = { "parentid" })
	private Integer parentid;
//	@FieldConvert(targetFiledName = { "menuGrade" })
//	private Integer menuGrade;
//	@FieldConvert(targetFiledName = {"menuType"})
//	private Integer menuType;
//	public Integer getMenuType() {
//		return menuType;
//	}
//
//	public void setMenuType(Integer menuType) {
//		this.menuType = menuType;
//	}

	@FieldConvert(targetFiledName = { "subCategory" }, isCollection = true, elementType = CategoryVO.class)
	private List<CategoryVO> subCategory;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getKeyassit() {
		return keyassit;
	}

	public void setKeyassit(String keyassit) {
		this.keyassit = keyassit;
	}

	public Integer getLevel() {
		return level;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}

	public Integer getParentid() {
		return parentid;
	}

	public void setParentid(Integer parentid) {
		this.parentid = parentid;
	}

	public String getPagename() {
		return pagename;
	}

	public void setPagename(String pagename) {
		this.pagename = pagename;
	}

	public List<CategoryVO> getSubCategory() {
		return subCategory;
	}

	public void setSubCategory(List<CategoryVO> subCategory) {
		this.subCategory = subCategory;
	}


	public void nameToCategory(Category cate) {
		ModelString modelString = new ModelString();
		modelString.setXmlContent(name);
		cate.setName(name);
	}	

	public void nameFromCategory(Category cate) {
		ModelString modelString = new ModelString();
		modelString.setXmlContent(cate.getName());
		setName(modelString.getValue());
	}	
}
